import sys
import re
import matplotlib
matplotlib.use('Agg')
from matplotlib.pyplot import *




if __name__ == "__main__":
	filename = sys.argv[1]
	results = []
	x = []
	jpgfilename = filename.split('.log')[0]
	fp = open(filename, "r")
	start = False
	for line in fp:
		line  = line.strip()
		if len(line) == 0 or line[0] == "#":
			continue
		line = re.split("\t", line.strip())
		results.append(float(line[3]))
		x.append(float(line[0]))
	fp.close()
	plot(x, results)
	savefig(jpgfilename  + "_decoherece" + ".jpg")
